<template>
  <div>
    <Product :data='productList' :ishav="ishav"></Product>
  </div>
</template>
<script>
import Product from './components/product_category.vue'
import { search } from '@/api/product.js'
import { ref, } from 'vue'
import { useStore } from "vuex";
export default {
  name:'serachshop',
  setup(){
    let store = useStore()
    let productList = ref()
    let ishav = ref(true)
    // let change = ref(sessionStorage.getItem('search'))
    search(store.state.search).then(res =>{
      productList.value =  res.data.data
      // console.log(res.data.data);
      if(res.data.data.length == 0){
        ishav.value = false
      }
    })
    // console.log(productList);
    // console.log(store.state.search);
    return {
      ishav,
      productList
    }
  },
  components:{
    Product
  }
}
</script>
<style scoped>
</style>